package KeyedState;

import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * 2 * @Author: 王杰
 * 3 * @Date: 2020/11/12 15:52
 * 4
 */
public class Test {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.fromElements(Tuple2.of(1L, 3L), Tuple2.of(1L, 5L), Tuple2.of(1L, 7L), Tuple2.of(1L, 4L), Tuple2.of(1L, 2L)).setParallelism(1)
                .keyBy(value -> value.f0)
                .flatMap(new CountWindowAverage())
                .print();


        env.execute();


    }
}
